package C_Paper;

import java.sql.SQLOutput;
import java.util.*;

public class C100_13 {
    //内存冷热标记
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] x = new int[n];
        for (int i = 0; i < n; i++) {
            x[i] = sc.nextInt();
        }
        int m = sc.nextInt();
        Map<Integer,Integer> map = new HashMap<>();
        for (int i : x) {
            map.put(i,map.get(i)== null?1:map.get(i)+1);
        }
        List<Integer> l = new ArrayList<>();
        for (Map.Entry<Integer, Integer> e : map.entrySet()) {
            if (e.getValue() >= m) l.add(e.getKey());
        }
        Collections.sort(l);
        System.out.println(l.size());
        l.forEach(System.out::println);
    }
}
